<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
/**
 * Football Referees extension for Joomleague
 * @version $Id:show_player.tpl.php 98 2008-02-25 23:38:14Z julien.vonthron $
 * @package JlgFootballReferees
 * @copyright Copyright (C) 2007 Julien Vonthron. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * JlgFootballReferees is free software and parts of it may contain or be derived from the
 * GNU General Public License or other free or open source software licenses.
 * 
 * contact: julien.vonthron[at]gmail.com 
 *   
 * Joomleague is a League Management and Prediction Game for Joomla!
 * Homepage: http://www.joomleague.de 
 *  
 */
?>

<div id="joomleague">

<!-- Header with Project Name-->
<?php if ($overall_config['show_project_heading'] == "1") { ?>
<div class="componentheading" <?php if ($overall_config['show_print_button'] == "1") echo 'style="float:left;"';?>><?php echo HTML_joomleague::showTitle($joomleague, $overall_config['project_heading_type']); ?></div>
<!-- Druckfunktion -->
<?php if ($overall_config['show_print_button'] == "1") {
HTML_joomleague::PrintIcon( $row, $params, false, '' );
};?>
<!-- Druckfunktion Ende -->
<?php } ?>
<!-- Header END -->

<br />

<div id="projectreferee">
  <div id="refereeInfo">
	  <?php if ($referee->picture): ?>
	  <div id="refpic">
	    <img src="<?php echo $referee->picture;?>" 
	         alt="<?php echo $referee->firstname. ' ' .$referee->lastname;?>"/>
	  </div>
	  <?php endif; ?>
	  <table align="left" border="0" cellpadding="3" cellspacing="0">
	    <tr>
	      <th><?php echo _JL_REFEXT_NAME; ?></th>
	      <td><?php echo $referee->firstname. ' ' .$referee->lastname; ?></td>
	    </tr>
	    <?php if ( $referee_config['show_born'] && $referee->birthday != '0000-00-00' ): ?>
	    <tr>
	      <th><?php echo _JL_REFEXT_BIRTHDAY; ?></th>
	      <td><?php echo mbiFormatDate( $referee->birthday, _JL_DAYDATE ); ?></td>
	    </tr>
      <?php endif; ?>
	    <?php if ( $referee_config['show_nation'] && $referee->nation ): 
        $thiscountry = new Country($database);
        $thiscountry->load($referee->nation); ?>
	    <tr>
	      <th><?php echo _JL_REFEXT_COUNTRY; ?></th>
	      <td><?php echo $thiscountry->getFlag(); ?></td>
	    </tr>
      <?php endif; ?>
		  <tr>
	      <th><?php echo _JL_REFEXT_DESCRIPTION; ?></th>
	      <td><?php echo ($referee->description) ? $referee->description: '-'; ?></td>
	    </tr>
		</table>
    <div class="clear"></div>
	</div>
	
<?php 
  $colspan = 6;
  if ($page_config['show_matchday']) $colspan++;
?>
	<div id="games">
	<table border="0" cellpadding="3" cellspacing="0">
	<thead>
	 <tr>
	   <td colspan="<?php echo $colspan; ?>">
	   <?php echo _JL_REFEXT_MATCHES_AS_REFEREE; ?>
	   </td>
	   <?php foreach ($events AS $key => $ev) { ?>
      <td width="5px" style="text-align:center;">
        <?php if ($ev->eventtype->icon): ?>
        <img src="<?php echo _JOOMLA_JL_LIVE_SITE; ?>/images/joomleague/event_icons/<?php echo $ev->eventtype->icon;?>" alt="<?php echo $ev->eventtype->name; ?>" title="<?php echo $ev->eventtype->name; ?>" />
        <?php else: ?>
        <?php echo $ev->eventtype->name; ?>
        <?php endif; ?>
      </td>
     <?php } ?>
	 </tr>
	</thead>
	<tbody>
	<?php
	$k=0;
	foreach ( $games AS $game ) {
		$home = $teams[$game->matchpart1];
    $away = $teams[$game->matchpart2];
    ?>
        <tr class="sectiontableentry<?php echo ($k++ % 2)+1; ?>">
        
          <?php if ($page_config['show_matchday']): ?>
          <td width="5px" style="text-align:center;">
          <a href="<?php echo sefRelToAbs(JL_COMPONENT_LINK.'&amp;func=showResults&amp;p='.$game->project_id.'&amp;r='.$game->matchcode.JL_ITEMID_SUFFIX);?>">
            <?php echo $game->matchcode; ?></a>
          </td>
          <?php endif; ?>
          
          <?php
          echo '<td>';
          echo mosFormatDate( $game->match_date, _JL_REFEXT_MATCH_DATE_FORMAT );
          echo "</td>";
          echo '<td>';
          echo mosFormatDate( $game->match_date, _JL_REFEXT_MATCH_STARTTIME_FORMAT );
          echo "</td>";
          echo '<td nowrap="nowrap" style="text-align:right;">';
          echo $home->name;
          echo "</td>";
          echo '<td nowrap="nowrap">-</td>';
          echo '<td nowrap="nowrap" style="text-align:left;">';
          echo $away->name;
          echo "</td>";
          echo '<td nowrap="nowrap">';
          if (!$game->alt_decision) {
            echo $game->matchpart1_result.':'.$game->matchpart2_result;
          }
          else {
            echo $game->matchpart1_result_decision.':'.$game->matchpart2_result_decision;          	
          }
          echo "</td>";
          
          foreach ($events AS $key => $ev) { 
            ?>
			      <td width="5px" style="text-align:center;">
			        <?php echo ( isset($ev->stats[$game->match_id]->sum ) ) ? $ev->stats[$game->match_id]->sum : 0 ; ?>
			      </td>
			      <?php 
          }
          ?>
          </tr>
          <?php			    
        }
  ?>
  </tbody>
  <tfoot>
   <tr>
     <td colspan="<?php echo $colspan; ?>" style="text-align:right;"><?php echo 'Sum'; ?>
     </td>
     <?php foreach ($events AS $key => $ev) { ?>
     <td style="text-align:center;"><?php echo $ev->sum; ?></td>
     <?php } ?>
   </tr>
  </tfoot>
	</table>
	</div>
</div>

<!-- Print Button START -->
<?php if ($overall_config['show_back_button'] > 0) {;?>
<?php if ($overall_config['show_back_button'] == "1") echo '<div align="left">'; else echo '<div align="right">';?>
<?php
$params = & new mosParameters( '' );
$params->def( 'back_button', true );
$params->def( 'popup', false );
mosHTML::BackButton( $params );
  echo "</div>";
};?>
<!-- Print Button END -->
</div>
